<template>
  <div id="app">
    <keep-alive>
      <router-view
        :key="componentKey"
        v-if="$route.meta.keepAlive"
      ></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>
<script>
export default {
  name: 'app',
  data() {
    return {
      isRouterAlive: true,
      componentKey: 0,
    }
  },
  provide() {
    return {
      reload: this.reload,
    }
  },

  methods: {
    reload() {
      this.isRouterAlive = false
      this.$nextTick(() => {
        this.isRouterAlive = true
      })
    },
    refreshComponent() {
      this.componentKey++ // 改变组件的 key 值以强制刷新组件
    },
  },
  computed: {
    key() {
      return this.$forceUpdate.path + Math.random()
    },
  },
  mounted() {
    if (process.env.NODE_ENV != 'development') {
    }
  },

  watch: {},
}
</script>
<style lang="less">
//rem适配
.html-font-size(@design-font-size, @design-width);

//
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: absolute;
  left: 0%;
  top: 0;
  width: 100%;
  height: 100%;
  color: #2c3e50;

  background-color: #fff;
  max-width: 750px;
}

.areaPopUp .van-picker__columns .van-picker-column:first-child {
  display: none;
}
</style>
